www.gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\bayes\bhattach.m

    function [eps]=bhattach(M1,M2,C1,C2,P1,P2)
% BHATTACH upper estimate on Bayes class. error.
%  [eps]=bhattach(M1,M2,C1,C2,P1,P2)
%
% BHATTACH calculates Bhattacharya's limit, i.e. upper estimate
%   of mean classification error for Bayesian classifier
%   minimizing errorneous classification into two classes for
%   normally (Gauss) distributed conditional probabilities p(x|k).
%   The conditional probabilities are  p(x|k) are described by
%   a pair of mean value and covariance matrix.
%
% Input:
%   M1 [Nx1] - mean value for class 1
%   M2 [Nx1] - mean value for class 2
%   C1 [NxN] - covariance matrix for class 1
%   C2 [NxN] - covariance matrix for class 2
%   P1 [1x1] - apriori probability for class 1
%   P2 [1x1] - apriori probability for class 2
%
%   where N is dimension of the feature space.
%
% Output:
%   eps - upper limint of the mean classification error
%
% See also BAYESCLN.
%

% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Written Vojtech Franc (diploma thesis) 02.01.2000
% Modifications
% 24. 6.00 V. Hlavac, comments into English.


M1=M1(:);
M2=M2(:);

d=(1/8)*(M2-M1)'*inv((C1+C2)/2)*(M2-M1)+(1/2)*...
    log( det((C1+C2)/2) / sqrt(det(C1)*det(C2)) );

eps=sqrt(P1*P2)*exp(-d);